#include <iostream>
#include "data.hpp"
#include "server.hpp"
#define OFFLINE 0
#define ONLINE 1
void DataTest()
{
	im_sys::UserTable *_user=new im_sys::UserTable();
	bool ret = _user->Exists("liuneng");
	if(ret !=true){
		_user->Insert("liuneng","121212");
	}
	std::cout<<"user is already exists!\n";

	_user->Update_Status("liuneng",ONLINE);
	int status = _user->Status("liuneng");
	if(status== ONLINE){
		std::cout<<"online user\n";
	}else if(status==OFFLINE){
		std::cout<<"offline user\n";
	}

	_user->Update_Passwd("liuneng","123123");
	ret=_user->UserPassCheck("liuneng","123123");
	if(ret==false){
		std::cout<<"用户名密码错误！\n";
	}else{
		std::cout<<"longin success! \n";
	}
}

void ServerTest()
{

	im_sys::Server *server=new im_sys::Server();
	server->RunModule();
	return ;
}
int main()
{
	ServerTest();
	//DataTest();
	return 0;
}
